package cate.game.activity.commonstarup.po;

import cate.common.table.activity.commonstarup.CommonStarUpRow;
import cate.game.activity.base.core.SubActivitySingle;
import cate.game.activity.commonstarup.CommonStarUpGiftActivity;
import cate.game.res.MixRes;
import com.fasterxml.jackson.annotation.JsonIgnore;
import easy.java.dev.note.NoteField;

import java.beans.Transient;

public class CommonStarUpGiftBag extends SubActivitySingle<CommonStarUpGiftActivity> {
    public int id;
    @NoteField("能否领取")
    public boolean available;
    @NoteField("是否领取过免费奖励")
    public boolean got;
    @NoteField("礼包购买次数")
    public int buyTimes;

    public CommonStarUpGiftBag() {
    }

    public CommonStarUpGiftBag(int id,boolean available, boolean got, int buyTimes) {
        this.id = id;
        this.available = available;
        this.got = got;
        this.buyTimes = buyTimes;
    }

    //开启礼包
    public void enablePack() {
        this.available = true;
    }

    @JsonIgnore
    public MixRes getPackReward() {
        return new MixRes(getRow().reward);
    }
    @JsonIgnore
    public MixRes getCustomPackReward() {
        return new MixRes(role.getGame().table.customGrowth.customGrowth.get(this.id).reward);
    }


    public void addBuyTimes() {
        this.buyTimes++;
    }

    public void isGot() {
        this.got = true;
    }

    @JsonIgnore
    @Transient
    public CommonStarUpRow getRow() {
        return role.getGame().table.commonStarUp.commonStarUp.get(this.id);
    }
}
